<template>
  <Card>
    <p slot="title">收款配置</p>
    <div class="search-con search-con-top">
      <div>
        姓名：
        <Input v-model="searchData.user_name" style="width: 200px"></Input>
        手机号：
        <Input v-model="searchData.mobile" style="width: 200px"></Input>
        <Button @click="search" type="primary" icon="ios-search" style="margin-left: 10px;">搜索</Button>
        <Button @click="reset" type="success" icon="ios-refresh" style="margin-left: 10px;">刷新</Button>
        <!-- <Button type="info" @click="handleSelectAll(true)" shape="circle" style="margin-left: 10px;">同步数据</Button> -->
      </div>
    </div>
    <Table :columns="columns" :data="list" ref="selection" border style="margin-top: 10px;">
      <template slot-scope="{ row , index}" slot="makeSlot">
        <i-button type="primary" size="small" @click="edit(row)">编辑</i-button>
      </template>
    </Table>
    <br>

    <Page :total="total" show-sizer show-total show-elevator @on-change="changePage" @on-page-size-change="changeSize">
    </Page>
  </Card>
</template>

<script>
import config from "@/config";
import { getToken } from "../../libs/util";
const baseImgeUrl = process.env.NODE_ENV === "development" ? config.baseUrl.dev : config.baseUrl.pro;
export default {
  name: "userPaymentList",
  data() {
    return {
      searchData: {
        page: 1,
        limit: 10
      },
      // 列表
      columns: [
        {
          title: 'ID',
          align:"center",
          key: 'id'
        },
        {
          title: '用户名',
          align:"center",
          key: 'nick',
        },
        {
          title: '手机号',
          align:"center",
          key: 'mobile',
        },
        {
          title: '银行名称',
          align:"center",
          key: 'bank_name',
        },
        {
          title: '银行卡号',
          align:"center",
          key: 'card_no'
        },
        {
          title: '办卡人姓名',
          align:"center",
          key: 'card_user',
        },
        {
          title: '支行',
          align:"center",
          key: 'branch_name',
        },
        // {
        //   title: '网络链',
        //   key: 'usdt_chain',
        // },
        // {
        //   title: '钱包地址',
        //   key: 'usdt_address',
        // },
        // {
        //   title: '钱包二维码',
        //   key: 'usdt_url',
        //   render: (h, param) => {
        //     if (!param.row.usdt_url) {
        //       return h("span", {});
        //     }
        //     return h("img", {
        //       attrs: {
        //         src: baseImgeUrl + param.row.usdt_url
        //       },
        //       style: {
        //         width: '80px',
        //         height: '60px'
        //       }
        //     });
        //   }
        // },
        {
          title: '微信收款码',
          align:"center",
          key: 'wechat_img',
          render: (h, param) => {
            return h("img", {
              attrs: {
                src: baseImgeUrl + param.row.wechat_img
              },
              style: {
                width: '80px',
                height: '60px'
              }
            });
          }
        },
        {
          title: '支付宝收款码',
          align:"center",
          key: 'alipay_img',
          render: (h, param) => {
            if (!param.row.alipay_img) {
              return h("span", {});
            } else {
              return h("img", {
                attrs: {
                  src: baseImgeUrl + param.row.alipay_img
                },
                style: {
                  width: '80px',
                  height: '60px'
                }
              });
            }

          }
        },
        // {
        //   title: '操作',
        //   slot: 'makeSlot',
        // },
      ],
      // 数据
      list: [],
      total: 0,
      // 编辑框
      editModal: false,
      formItem: {},
    }
  },
  methods: {
    // 查询管理员信息
    getList() {
      let params = {
        ...this.searchData,
      };
      this.$axios('/admin/member/getPaymentList', params).then(res => {
        this.list = res.data;
        this.total = res.total;
      });
    },
    search() {
      this.searchData.page = 1;
      this.getList();
    },
    reset() {
      this.searchData = {
        page: 1,
        limit: 10,
      };
      this.getList();
    },
    changePage(page) {
      this.searchData.page = page;
      this.getList();
    },
    changeSize(size) {
      this.searchData.limit = size;
      this.getList();
    },
    editModalOk() { },
    editModalCancel() { },
    edit(row) {
      this.formItem = row;
      if (row.city_id != 0) {
        this.cityList = [{ id: row.city_id, name: row.city_name }];
      }
      if (row.area_id != 0) {
        this.areaList = [{ id: row.area_id, name: row.area_name }];
      }
      this.getProvinceList();
      this.editModal = true;
    },
  },
  created() {
    this.getList();
  }
}
</script>
<style></style>
